<?php
	/**
	*
	*
	*/
	class Db {
		var $host 		= "10.5.20.110";
		var $user 		= "application";
		var $password	= "application_my12";
		var $database	= "soumission";
		var $connId;
		var $output 	= array();
		var $result;
		/**
		*Connexion � la base MySQL
		*
		*/
		function connect(){
			$this->connId = mysql_connect($this->host,$this->user,$this->password);
			mysql_select_db($this->database,$this->connId) or die ("Erreur de connexion a la base ");
		}
		/**
		*Execution de la requette.
		*
		*/
		function query($sql){
			
			
			$this->result = @mysql_query($sql);
			echo mysql_error();
			return  $this->result;
		}
		/**
		* Nombre de lignes affect�es
		*
		*/
		function affectedRows(){
			$count = @mysql_affected_rows($this->connId);
			return $count;
		}
		/**
		*
		*
		*/
		function fetchArray(){
			//unset($this->output);
			while ($data = @mysql_fetch_array($this->result)) {
			   $this->output[] = $data;
			}
			return $this->output;
		}
		/**
		*
		*
		*/
		function fetchObject(){
			$row = @mysql_fetch_object($this->result);
			return $row;
		}
		/**
		*
		*
		*/
		function numRows(){
			$count = @mysql_num_rows($this->result);
			return $count;		
		}
		/**
		*
		*
		*/
		function disconnect(){
			mysql_close($this->connId);
		}
	}
?>
